<template>
	<div class="all">
		
	</div>
</template>

<script>
	import axios from 'axios'
	export default {
		name: 'login',
		data() {
			return {
				
			}
		},
		created() {
			this.login()
		},
		methods: {
			//登陆
			login: function() {
				//测试登录
				// this.axios.post(this.url+`/web/user/login?username=admin&password=123456`)
				// 	.then(response => {
				// 		if (response.data.success == true) {
				// 			this.person = response.data.result.userInfo
				// 			localStorage.setItem('token', response.data.result.token)
				// 			this.$router.push('/')
				// 		} else {
				// 			this.$message.error(response.data.message);
				// 		}
				// 	})
				let lll = localStorage.getItem("token")
				if(lll == null){
					//微信登录
					this.axios.post(this.url+`/mobile/api/wechatLogin?code=`+this.$route.query.code)
						.then(response => {
							if (response.data.success == true) {
								this.person = response.data.result.userInfo
								localStorage.setItem('token', response.data.result.token)
								this.$router.push('/')
							} else {
								this.$toast(response.data.message);
							}
						})
				}else{
					this.$router.push('/')
				}
				
					
			}
		},

	}
</script>

<style scoped lang="less">
	.all {
		display: flex;
		height: 100vh;
		align-items: center;
		justify-content: center;

		.logo {
			text-align: center;
			margin-bottom: 20px;
		}

		.title {
			font-size: 25px;
			text-align: center;
			margin-bottom: 50px;
			font-weight: bold;
			background-image: linear-gradient(135deg, red, blue);
			-webkit-background-clip: text;
			color: transparent;
		}
	}
</style>
